<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:c="http://xmlns.jcp.org/jsf/composite"
	xmlns:p="http://primefaces.org/ui">

<ui:decorate template="/jsp/WEB/pageLayout.xhtml">
	<ui:define name="centro">
		<h:form id="form">

			<p:panel header="Dados Para Busca" style="width:150%">

				<p:messages id="messages" showDetail="true" autoUpdate="true"
					closable="true" />

				<p:focus for="nome" />
				<h:outputScript name="calendario_pt_BR.js" library="js" />
				<h:panelGrid id="gridRel" columns="2"
					style="border:0px;margin-top:1%;">
					<h:outputLabel value="Nome do Produto:" />
					<p:inputText id="nome" value="#{RelatorioEstoqueBean.nome}" />
					<p:outputLabel for="date" value="Data inicial:" />
					<p:calendar id="date" value="#{RelatorioEstoqueBean.initialDate}"
						locale="pt_BR" pattern="dd/MM/yyyy">
					</p:calendar>

					<h:outputLabel for="datefim" value="Data final:" />
					<p:calendar id="datefim" value="#{RelatorioEstoqueBean.finalDate}"
						locale="pt_BR" pattern="dd/MM/yyyy">
					</p:calendar>
					<p:commandButton id="searchButton" value="Buscar"
						image="ui-icon-search" update="@form" ajax="false"
						title="Localizar Pedidos"
						actionListener="#{RelatorioEstoqueBean.exibirRelatorio()}" />
				</h:panelGrid>
			</p:panel>
			<br />
			<p:panel header="Relatório de Movimentação de Estoque" style="width:150%">

				<f:facet name="actions">
					<h:commandLink
						styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default" title="Imprimir">
						<h:outputText styleClass="ui-icon ui-icon-print" />
						<p:printer target="Rel" />
					</h:commandLink>

					<h:commandLink
						styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default"
						style="width:16px;heigh:16px;" >
						<p:graphicImage style=" margin-top:1px;margin-left:2px" title="Exportar relatório para excel"
							url="/imagens/ui-xls.png"></p:graphicImage>
						<p:dataExporter type="xls" target="Rel"
							fileName="Movimentação Estoque" />
					</h:commandLink>
				</f:facet>

				<p:dataTable id="Rel" value="#{RelatorioEstoqueBean.rel}" var="rel"
					rowIndexVar="rowIndex" emptyMessage="Nenhum registro encontrado"
					style="position: auto;margin-top:40px" paginator="true" rows="20"
					rowsPerPageTemplate="10,20,30,40,50">
					<p:column style="width: 97px" sortBy="nome">
						<f:facet name="header">Produto</f:facet>
						<h:outputText value="#{rel.nome}" />
					</p:column>
					<p:column style="width: 97px;text-aling:center" sortBy="tpMov">
						<f:facet name="header">Tipo Movimentação</f:facet>
						<h:outputText value="#{rel.tpMov}" />
					</p:column>
					<p:column style="width: 97px;text-aling:center" sortBy="unitMov">
						<f:facet name="header">Unidade Movimentação</f:facet>
						<h:outputText value="#{rel.unitMov}" />
					</p:column>
					<p:column style="width: 97px;text-aling:center" sortBy="qtdeMov">
						<f:facet name="header">Quantidade Movimentação</f:facet>
						<h:outputText value="#{rel.qtdeMov}" />
					</p:column>
					<p:column style="width: 97px;text-aling:center" sortBy="totalMov">
						<f:facet name="header">Total Movimentação</f:facet>
						<h:outputText value="#{rel.totalMov}" />
					</p:column>
					<p:column style="width: 97px;text-aling:center" sortBy="dataMov">
						<f:facet name="header">Data Movimentação</f:facet>
						<h:outputText value="#{rel.dataMov}">
							<f:convertDateTime locale="pt_BR" pattern="dd/MM/yyyy" />
						</h:outputText>
					</p:column>
					<p:column style="width: 97px;text-aling:center" sortBy="hora">
						<f:facet name="header">Hora</f:facet>
						<h:outputText value="#{rel.hora}">
							<f:convertDateTime locale="pt_BR" pattern="hh:mm:ss" />
						</h:outputText>
					</p:column>
					<p:column style="width: 97px;text-aling:center" sortBy="saltoQtde">
						<f:facet name="header">Saldo Quantidade R$</f:facet>
						<h:outputText style="text-align:right" value="#{rel.saldoQtde}">

						</h:outputText>
					</p:column>
					<p:column style="width: 97px;text-aling:center" sortBy="valorMed">
						<f:facet name="header">Valor Medio Unidade R$</f:facet>
						<h:outputText style="text-align:right" value="#{rel.valorMed}">
							<f:convertNumber locale="pt_BR" currencyCode="BRL"
								minFractionDigits="2" />
						</h:outputText>
					</p:column>
					<p:column style="width: 97px;text-aling:center" sortBy="valorEstoq">
						<f:facet name="header">Valor Estoque Total R$</f:facet>
						<h:outputText style="text-align:right" value="#{rel.valorEstoq}">
							<f:convertNumber locale="pt_BR" currencyCode="BRL"
								minFractionDigits="2" />

						</h:outputText>
					</p:column>
				</p:dataTable>
			</p:panel>
		</h:form>
	</ui:define>
</ui:decorate>

</html>
